import React from 'react'
import Icon from '@/components/Icon'
import styles from './index.module.scss'
import { useHistory } from 'react-router-dom'
import classNames from 'classnames'
export default function Login({
  className,
  children,
  onLeftClick,
  rightContent
}) {
  const history = useHistory()
  const defaultClick = () => history.go(-1)
  return (
    <div className={classNames(styles.root, className)}>
      {/* 后退按钮 */}
      <div className='left' onClick={onLeftClick || defaultClick}>
        <Icon type='iconfanhui' />
      </div>
      {/* 居中标题 */}
      <div className='title'>{children}</div>

      {/* 右侧内容 */}
      <div className='right'>{rightContent}</div>
    </div>
  )
}
